﻿using System.Drawing;
using PlusPlusPaint.Layers.VisualObjects;

namespace PlusPlusPaint.Tools
{
    class FilledEllipseTool : RectangleShapedObjectCreationTool
    {
        protected override void UpdatePreview(Point begin, Point end)
        {
            Layer.Invoke<FilledEllipse>((o) =>
            {
                o.ResizeToBeIn(begin, end);
            });
            using (Brush br = new SolidBrush(this.Colour))
                Graphics.FromImage(Preview).FillEllipse(br, GetBoundingRectangle(begin, end));
        }

        protected override void Complete()
        {
            Layer.Invoke<FilledEllipse>((o) =>
            {
                o.Colour = this.Colour;
            });
        }
    }
}
